
import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/admin-service/file/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/admin-service/file',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/admin-service/file/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/admin-service/file/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/admin-service/file',
    method: 'put',
    data: obj
  })
}

export function onlineFile(bucketName, fileName) {
  return request({
    url: `/admin-service/file/online/${bucketName}/${fileName}`,
    method: 'get'
  })
}


//分片上传接口
export function taskInfo(identifier) {
  return request({
    url: `/admin-service/file/process/${identifier}`,
    method: 'get'
  })
}

export function createTask(body) {
  return request({
    url: `/admin-service/file/createTask`,
    method: 'post',
    data: body
  })
}

export function preSignUrl({ identifier, partNumber}) {
  return request({
    url: `/admin-service/file/process/${identifier}/${partNumber}`,
    method: 'get',
  })
}

export function merge(identifier) {
  return request({
    url: `/admin-service/file/process/merge/${identifier}`,
    method: 'post'
  })
}
